#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

int main()
{
	pid_t pid;

	if ((pid = fork()) == 0) {
		open("child", O_RDWR |O_CREAT, S_IRUSR |S_IWUSR | S_IXUSR);	
		printf("real uid = %d, effective uid = %d\n", getuid(),geteuid());
		return 0;
	} else if (pid > 0) {
		open("father", O_RDWR | O_CREAT, S_IRUSR |S_IWUSR | S_IXUSR);	
		printf("real uid = %d, effective uid = %d\n", getuid(),geteuid());
		return 0;
	} else {
		fprintf(stderr, strerror(errno), 0777);	
		return (-1);
	}	
	
}
